@page
@{ Layout = "_LayoutHome"; }
@section Styles{
    <style>
        .el-form-item {
            margin-bottom: 0px;
        }
    </style>
}
<el-card>
    <div slot="header">
        <el-form :inline="true" :model="form">
            <el-form-item label="开考时间">
                <el-select v-model="form.date" placeholder="开考时间">
                    <el-option label="全部" value=""></el-option>
                    <el-option label="今天" value="today"></el-option>
                    <el-option label="三天内" value="three"></el-option>
                    <el-option label="一周内" value="week"></el-option>
                    <el-option label="当月" value="month"></el-option>
                    <el-option label="当年" value="year"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="试卷">
                <el-input prefix-icon="el-icon-search" v-model="form.keyWords" placeholder="关键字"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" plain icon="el-icon-search" v-on:click="btnSearchClick">查询</el-button>
            </el-form-item>
        </el-form>
    </div>
    <el-scrollbar class="scrollbar" :style="{ height: ($(window).height()-136) + 'px' }">
        <div class="pe-3" v-if="total>0">
            <div class="ms-5 position-relative card-hover-with-icon animate__animated animate__fadeInRight" v-for="(paper,index) in list" v-on:click="btnViewClick(paper.id)">
                <div class="position-absolute top-50 start-0 translate-middle">
                    <div class="position-relative">
                        <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="13" y="10" width="28" height="34" fill="none" stroke="#333" stroke-width="1" stroke-linejoin="miter" /><path d="M35 10V4H8C7.44772 4 7 4.44772 7 5V38H13" stroke="#333" stroke-width="1" stroke-linecap="round" stroke-linejoin="miter" /><path d="M21 22H33" stroke="#333" stroke-width="1" stroke-linecap="round" stroke-linejoin="miter" /><path d="M21 30H33" stroke="#333" stroke-width="1" stroke-linecap="round" stroke-linejoin="miter" /></svg>
                        <span class="position-absolute top-100 start-100 translate-middle mt-1 fs-6">{{ index+1 }}</span>
                    </div>
                </div>
                <el-card shadow="hover" class="mb-2">
                    <div class="row align-items-center g-3 ms-6">
                        <div class="col">
                            <div class="mb-2">
                                <el-link :underline="false" v-on:click.stop="btnViewClick(paper.id)">
                                    <span class="fw-bold card-icon bg-white px-3 py-1 rounded-pill">{{ paper.title }}</span>
                                </el-link>
                            </div>
                            <ul class="list-inline fw-light ms-3">
                                <li class="list-inline-item fs-5">
                                    总分：{{paper.totalScore}}
                                </li>
                                <li class="list-inline-item fs-5">
                                    及格分：{{paper.passScore}}
                                </li>
                                <li class="list-inline-item fs-5">
                                    开考时间：{{ paper.examStartDateTimeStr }}
                                </li>
                                <li class="list-inline-item fs-5">
                                    剩余考试次数：
                                    <span class="fs-3 text-success fw-bold" v-if="(paper.userExamTimes-paper.myExamTimes)>0">
                                        {{paper.userExamTimes-paper.myExamTimes}}
                                    </span>
                                    <span class="fs-3 text-danger fw-bold" v-else>
                                        0
                                    </span>
                                    /{{paper.userExamTimes}}
                                </li>
                            </ul>
                        </div>
                        <div class="col-auto">
                            <div class="bg-light p-2 rounded-pill">
                                <el-button type="primary" plain icon="el-icon-s-order" class="rounded-pill" v-on:click.stop="btnViewClick(paper.id)">详 细</el-button>
                            </div>
                        </div>
                    </div>
                </el-card>
            </div>
            <div class="my-5 text-center me-5">
                <el-button icon="el-icon-refresh-right" v-if="list.length>0 && list.length<total" v-on:click="btnLoadMoreClick" :loading="loadMoreLoading">加载更多</el-button>
                <span v-else class="fw-light">没有更多了</span>
            </div>
        </div>
        <div class="pt-10" v-else>
            <el-empty></el-empty>
        </div>
    </el-scrollbar>
</el-card>

@section Scripts{
    <script src="/sitefiles/assets/js/home/exam/examPaper.js" type="text/javascript"></script>
}